<template>
  <div class="classify">
    <div class="top_bar">
      <div class="tabs">
        <van-tabs
          v-model="direction"
          background="#fff"
          :line-width="0"
          :line-height="0"
        >
          <van-tab name="男生" title="男生">
            <div class="choice_type">
              <div
                class="type"
                :class="[{ active: type == choicetype }]"
                v-for="(type, index) in boyTypes"
                :key="index"
              >
                <span @click="clickType(type)">{{ type }}</span>
              </div>
            </div>

            <div class="book_data">
              <div class="filter">
                <div class="new_hot">
                  <span
                    @click="hotNew = 畅销"
                    :class="{ active: hotNew == '畅销' }"
                    >畅销</span
                  >
                  <span
                    @click="hotNew = 畅销"
                    :class="{ active: hotNew == '最新' }"
                    >最新</span
                  >
                </div>
                <div class="btn">
                  <div class="icon">
                    <span class="iconfont icon-xiajiantou"></span>
                  </div>
                  筛选
                </div>
              </div>
              <ul>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
              </ul>
            </div>
          </van-tab>
          <!-- 女生块 -->
          <van-tab name="女生" title="女生">
            <div class="choice_type">
              <div
                class="type"
                :class="[{ active: type == choicetype }]"
                v-for="(type, index) in girlTypes"
                :key="index"
              >
                <span @click="clickType(type)">{{ type }}</span>
              </div>
            </div>

            <div class="book_data">
              <div class="filter">
                <div class="new_hot">
                  <span
                    @click="hotNew = 畅销"
                    :class="{ active: hotNew == '畅销' }"
                    >畅销</span
                  >
                  <span
                    @click="hotNew = 畅销"
                    :class="{ active: hotNew == '最新' }"
                    >最新</span
                  >
                </div>
                <div class="btn">
                  <div class="icon">
                    <span class="iconfont icon-xiajiantou"></span>
                  </div>
                  筛选
                </div>
              </div>
              <ul>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
              </ul>
            </div>
          </van-tab>
          <!-- 出版块 -->
          <van-tab name="出版" title="出版"
            ><div class="choice_type">
              <div
                class="type"
                :class="[{ active: type == choicetype }]"
                v-for="(type, index) in publicTypes"
                :key="index"
              >
                <span @click="clickType(type)">{{ type }}</span>
              </div>
            </div>

            <div class="book_data">
              <div class="filter">
                <div class="new_hot">
                  <span
                    @click="hotNew = 畅销"
                    :class="{ active: hotNew == '畅销' }"
                    >畅销</span
                  >
                  <span
                    @click="hotNew = 畅销"
                    :class="{ active: hotNew == '最新' }"
                    >最新</span
                  >
                </div>
                <div class="btn">
                  <div class="icon">
                    <span class="iconfont icon-xiajiantou"></span>
                  </div>
                  筛选
                </div>
              </div>
              <ul>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
              </ul>
            </div></van-tab
          >

          <!-- 听书块 -->
          <van-tab name="听书" title="听书">
            <div class="choice_type">
              <div
                class="type"
                :class="[{ active: type == choicetype }]"
                v-for="(type, index) in listenTypes"
                :key="index"
              >
                <span @click="clickType(type)">{{ type }}</span>
              </div>
            </div>

            <div class="book_data">
              <div class="filter">
                <div class="new_hot">
                  <span
                    @click="hotNew = 畅销"
                    :class="{ active: hotNew == '畅销' }"
                    >畅销</span
                  >
                  <span
                    @click="hotNew = 畅销"
                    :class="{ active: hotNew == '最新' }"
                    >最新</span
                  >
                </div>
                <div class="btn">
                  <div class="icon">
                    <span class="iconfont icon-xiajiantou"></span>
                  </div>
                  筛选
                </div>
              </div>
              <ul>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
                <li>
                  <div class="img">
                    <img src="../../assets/img/01.jpg" alt="" />
                  </div>
                  <div class="book_name">
                    <p>大都督,夫人他跑上瘾了</p>
                    <span>496章未读</span>
                  </div>
                </li>
              </ul>
            </div>
          </van-tab>
        </van-tabs>
        <span class="fdj iconfont icon-Magnifier"></span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      // 第一个选择
      direction: "男生",
      // 第二个选择
      choicetype: "都市",
      // 第三个
      hotNew: "畅销",
      // 男生快
      boyTypes: [
        "都市",
        "玄幻",
        "悬疑",
        "历史",
        "军事",
        "科幻",
        "同人",
        "短篇",
      ],
      // 女生块
      girlTypes: [
        "玄幻",
        "科幻",
        "悬疑",
        "传奇",
        "脑洞",
        "重生",
        "现言",
        "穿越",
        "宫斗",
        "古言",
        "短篇",
        "校园",
        "仙侠",
        "种田",
        "同人",
      ],
      // 出版块
      publicTypes: [
        "小说",
        "人文",
        "生活",
        "两性",
        "励志",
        "经管",
        "文学",
        "艺术",
        "科普",
        "育儿",
        "IT",
        "教辅",
        "外文",
      ],
      // 听说块
      listenTypes: [
        "都市",
        "言情",
        "武侠玄幻",
        "社科经管",
        "历史军事",
        "出版图书",
        "经典名家",
        "亲子儿童",
        "同人网游",
      ],
    };
  },
  methods: {
    clickType(type) {
      this.choicetype = type;
    },
  },
};
</script>

<style lang="less" scoped>
.classify {
  width: 100%;
  .top_bar {
    width: 100%;
    position: relative;
    height: 45px;
    .fdj {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      right: 27px;
      font-size: 20px;
      color: #bababa;
    }
    .tabs {
      /deep/.van-tabs__nav {
        .van-tab {
          flex: 0 0 50px;
          margin-left: 7px;
          padding: 0;
        }
        .van-tab__text--ellipsis {
          color: #bababa;
          font-size: 13px;
        }
        .van-tab--active {
          .van-tab__text--ellipsis {
            font-size: 18px;
            color: #4e4e4e;
          }
        }
      }
      .choice_type {
        // height: 72px;
        width: 100%;
        .type {
          display: inline-block;
          position: relative;
          // margin-left: 20px;
          // width: 53px;
          margin: 0 15px 0 15px;
          height: 36px;
          text-align: center;
          line-height: 36px;
          span {
            color: #1d1d1d;
            font-size: 13px;
          }
          &.active {
            color: #ea7860;
          }
          &.active::after {
            content: "";
            position: absolute;
            top: 80%;
            left: 50%;
            transform: translateX(-50%);
            background: #e54120;
            width: 15px;
            height: 3px;
          }
        }
      }
      .book_data {
        width: 100%;
        width: 100%;
        background: #fff;
        // padding: 0 14px;
        .filter {
          padding: 0 15px;
          height: 36px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          .new_hot {
            font-size: 12px;
            position: relative;
            color: #bababa;
            span {
              margin-right: 10px;
              &.active{
                color: #ea7860;
                
              }
            }
            &::after {
              position: absolute;
              top: 50%;
              left: 28px;
              transform: translateY(-50%);
              width: 2px;
              height: 10px;
              content: "";
              background-color: #c7c7c7;
            }
          }
          .btn {
            border-radius: 20px;
            width: 40px;
            height: 20px;
            border: 1px solid #bababa;
            font-size: 12px;
            color: #bababa;
            white-space: nowrap;
            display: flex;
            justify-content: center;
            align-items: center;
            .icon {
              transform: scale(0.5);
              .iconfont {
                color: #bababa;
                font-size: 12px;
              }
            }
          }
        }
        ul {
          display: flex;
          flex-wrap: wrap;
          // & li:nth-of-type(3n) {
          //   margin-right: 0;
          // }
          li {
            display: flex;
            flex-direction: column;
            justify-content: space-around;
            width: 33%;
            height: 200px;
            // margin-right: 23px;
            .img {
              width: 100px;
              height: 140px;
              margin: 0 auto;
              box-shadow: 3px 2px 8px -3px #706e6b;
              img {
                width: 100px;
                height: 140px;
                border-radius: 5px;
              }
            }
            .book_name {
              // width: 100%;
              margin: 0 auto;
              p {
                font-size: 13px;
                color: #000000;
                width: 100px;
                white-space: word-break;
                height: 25px;
              }
              span {
                font-size: 12px;
                color: #d4d4d4;
              }
            }
          }
        }
      }
    }
  }
}
</style>